package com.xxcxcxcx.jobsystem.mixin.job.Blacksmith;

import com.xxcxcxcx.jobsystem.Main;
import com.xxcxcxcx.jobsystem.common.Job.Blacksmith.ItemSmithIn;
import net.minecraft.world.entity.ai.attributes.Attribute;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;

import static com.xxcxcxcx.jobsystem.common.Job.Blacksmith.Blacksmith.*;

@Mixin(Item.class)
public abstract class ItemSmithMixin implements ItemSmithIn {
    @Override
    public void setNewDurable(ItemStack stack, float a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeTool,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeTool+Durable,a);
    }
    @Override
    public void setNewDamage(ItemStack stack, float a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeTool,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeTool+Damage,a);
    }
    @Override
    public void setNewDamageSpeed(ItemStack stack, float a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeTool,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeTool+DamageSpeed,a);
    }

    @Override
    public void setNewSpeed(ItemStack stack, float a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeTool,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeTool+Speed,a);
    }
    @Override
    public void setEffect(ItemStack stack, Attribute attribute, float num){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeTool,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeTool+attribute.getDescriptionId(),num);
    }
    @Override
    public void setKind(ItemStack stack, String kind){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeTool,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putString(MakeTool+ToolKind,kind);
    }
    @Override
    public void setCreater(ItemStack stack, Player player, int Level){
        stack.getOrCreateTagElement(Main.MOD_ID).putString(MakeTool+Creater, player.getName().getContents());
        stack.getOrCreateTagElement(Main.MOD_ID).putInt(MakeTool+CreaterLevel, Level);
        stack.getOrCreateTagElement(Main.MOD_ID).putString(MakeTool+ToolLevel, ToolUnIdentification);
    }
}
